home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 …ember: Reference Library / Dev.CD Dec 97 RL.toast / What's New / Tool Chest / Testing & Debugging / Virtual User / Examples / Example Scripts / KeyboardChaos.vu < prev    next >
Encoding:
Text File  |  1997-10-15  |  1.5 KB  |  49 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        KeyboardChaos.vu
  3. #
  4. #    Contains:    A very simple VU script that illustrates the use of the system tasks  
  5. #                random(), and typeSpeed().  Simply run it against any target machine.
  6. #                For efficiency, it will generate the list of keycodes to send to the
  7. #                target before sending them off.  The theSeed variable sets the random
  8. #                seed used when creating a random number.  To repeat a series of random
  9. #                numbers, set the theSeed parameter to the same value as a pervious test.
  10. #
  11. #    Conventions:    Global variables begin with a "g"
  12. #
  13. #    Written by:    David Gaxiola
  14. #
  15. #    Copyright:    © 1990-1992 by Apple Computer, Inc., all rights reserved.
  16. #
  17. #    Change History:
  18. #
  19. #         8/19/92    DGG        Made script parametric, added random seed ability.
  20. #         7/1/92        DGG        creation
  21. #
  22. #    To Do:
  23. #
  24.  
  25. script KeyboardChaosMain(gNumberOfSets := 20, gMaxNumberPerSet := 30, 
  26.                             gMinTypeSpeed := 50, gMaxTypeSpeed := 120,
  27.                             gKeycodeMin := 0, gKeycodeMax := 55, theSeed )
  28. begin
  29.     if IsUndefined(theSeed)
  30.         theSeed := Random();
  31.     println "The random seed is ", theSeed;
  32.     RandomSeed(theSeed);
  33.  
  34.     for counter := 1 to gNumberOfSets
  35.     begin
  36.         println "Starting set ", counter;
  37.         numberThisSet := Random(1, gMaxNumberPerSet);
  38.         TypeSpeed(Random(gMinTypeSpeed, gMaxTypeSpeed));
  39.         theKeycodeList := {};
  40.         for counter2 := 1 to numberThisSet
  41.         begin
  42.             theKeycode := Random(gKeycodeMin, gKeycodeMax);
  43.             theKeycodeList := Insert(theKeycode, 1, theKeycodeList);
  44.         end;
  45.         type c:theKeycodeList;
  46.         println theKeycodeList;
  47.     end;
  48. end;
  49.